﻿// owner 蒋家伟

#pragma once
#include "IDataDecodecManager.h"
#include "DataDecodecRegisterUtils.h"

namespace jsdk
{
    class DataDecodecManager: public IDataDecodecManager
    {
    public:
        static DataDecodecManager* get();
        bool registerCreator(const std::string& agreementHead, DataDecodecCreatorFunc func);

    private:
        // 继承IDataDecodecManager
        virtual OwnerPtr<IDataDecodec> getDataDecodec(const std::string& agreementHead) const override;

    private:
        std::map<std::string, DataDecodecCreatorFunc> m_agreementHeadToDecodecCreatorMap;
    };
}